﻿using ICSharpCode.AvalonEdit.CodeCompletion;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;

namespace JavaScriptEditor
{
    public class MyCompletionData : ICompletionData
    {
        public string Text 
        { 
            get; 
            set;
        }

        public MyCompletionData(string text) 
        {
            this.Text = text;
        }

        public MyCompletionData(string text,string description,ImageSource img)
        {
            this.Text = text;
            this.description = description;
            this.img = img;
        }
        private ImageSource img;
        public System.Windows.Media.ImageSource Image
        {
            get 
            { 
                return img; 
            }
        }
        
        public object Content
        {
            get 
            {
                return this.Text; 
            }
        }
        private string description;
        public object Description
        {
            get 
            { 
                return this.description; 
            }
        }

        public void Complete(TextArea textArea, ISegment completionSegment,EventArgs insertionRequestEventArgs)
        {
            textArea.Document.Replace(completionSegment, this.Text);
        }


        public double Priority
        {
            get 
            {
                return 0; 
            }
        }
    }
}
